package com.ftg.learn.chapter08.rdbms.service;

import com.ftg.learn.chapter08.rdbms.entity.RClazz;

/**
 * @author kangjx
 * @createTime 2023/1/5
 */
public class RclazzService {


    private static RClazz[] clazz;

    private static int index = 0 ;


    public RclazzService(int capacity){

    }

    public static void addClazz(RClazz rclz){
        if(clazz == null){
            clazz = new RClazz[10];
        }
        // 扩容
        // 班级主键不能一样
        clazz[index++] = rclz;
    }

    /**
     *
     * @return
     */
    public static RClazz getClazzByStuCno(Integer cno){
        if(null != cno){
            for (int i = 0; i < RclazzService.index; i++) {
                if(clazz[i].getCno() == cno){
                    return clazz[i];
                }
            }
        }
        return null;
    }

}
